<template>
<div class="container">
    <div class="header">
        <NavBar :title="pageInfo.pageTitle" left-arrow color="#333333" @click-left="back" @click-right="backHome">
            <template #right>
                <Icon name="wap-home-o" size="20" />
            </template>
        </NavBar>
    </div>
    <div class="main">
        <div class="art-ct c-html" v-html='content'></div>
    </div>
</div>
</template>

<script>
import {
    NavBar,
    Icon
} from "vant";
import http from '@/http.js';
export default {
    components: {
        NavBar,
        Icon
    },
    data() {
        return {
            id: "",
            content: "",
        };
    },
    created() {
        let {
            mode,
            id = ""
        } = this.$route.query;
        this.mode = mode;
        this.id = id;
        let requestParams = this.id ? {
            id: this.id
        } : {};
        http.request({
            url: this.pageInfo.requestUrl,
            method: "POST",
            data: requestParams,
        }).then(res => {
            if (res.code == 1) {
                this.content = this.id ? res.data.content : res.data;
            }
        })
    },
    computed: {
        pageInfo() {
            let pageList = [{
                    pageTitle: "咨询详情",
                    requestUrl: "/home/getNewsDetails"
                },
                {
                    pageTitle: "操作指南",
                    requestUrl: "/home/getOperationGuide"
                },
                {
                    pageTitle: "运单条款",
                    requestUrl: "/user/getElectronicWaybillClause"
                },
                {
                    pageTitle: "服务协议",
                    requestUrl: "/user/getWalletServiceAgreement"
                },
                {
                    pageTitle: "违禁品说明",
                    requestUrl: "/home/getContrabandDetails"
                },
                {
                    pageTitle: "钱包说明",
                    requestUrl: "/user/getExpressWalletExplain"
                },
                {
                    pageTitle: "积分说明",
                    requestUrl: "/user/getPointExplain"
                },
                {
                    pageTitle: "估算说明",
                    requestUrl: "/user/getFreightExplain"
                },
                {
                    pageTitle: "打木架说明",
                    requestUrl: "/user/woodIntroduce"
                },
            ]
            return pageList[this.mode];
        }
    }
};
</script>

<style lang="less" scoped>
.art-ct {
    background-color: #fff;
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    font-size: 14px;
    font-family: PingFang SC;
    font-weight: 400;
    color: #333333;
    line-height: 21px;
}
.art-ct p{
    width:100%!important;
}
</style>
